<?php
require '../../lib/init.php';

function LoadContent($template_name='content_home.tpl') { //content_home.tpl by default
    global $smarty;
    $smarty->display($template_name);
} 




if($_POST['buttonId']) {
    $buttonId=$_POST['buttonId'];
    // $buttonId='id_btn_clients';
    // echo $buttonId;
    switch($buttonId) {
        case 'id_btn_home':
            LoadContent('content_home.tpl');
            break;
        case 'id_btn_clients':
            GetContent('id_btn_clients');
            LoadContent('content_clients.tpl'); //последни проекти
            break;
        case 'id_btn_campaigns':
            GetContent('id_btn_campaigns');
            LoadContent('content_campaigns.tpl'); //последни проекти
            break;
        case 'id_btn_portfolio':
            $category_id=(int)$_POST['category_id'];
            $campaign_id=(int)$_POST['campaign_id'];
            GetContent('id_btn_portfolio',$pageNum,$category_id,$campaign_id);
            LoadContent('content_portfolio.tpl'); //портфолио
            break;
        case 'id_btn_contacts':
	    LoadContent('content_contacts.tpl'); // Контакти
            break;
        case 'id_btn_reklama':
            LoadContent('content_reklama.tpl'); // Реклама
            break;
    }
}


if($_POST['pageNum']) {
    $pageNum = (int) $_POST['pageNum'];
    $category_id = (int) $_POST['category_id'];
    GetContent('id_btn_portfolio',$pageNum,$category_id);
    LoadContent('portfolio-items.tpl');
}
